package com.baizhi.controller.product;


import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import com.baizhi.entity.PmsBrand;
import com.baizhi.service.IPmsBrandService;
import com.baizhi.vo.R;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author by
 * @since 2020-08-13
 */
@RestController
@RequestMapping("/brand")
public class PmsBrandController {

    @Autowired
    private IPmsBrandService brandService;

    @GetMapping("selectBrandBySize")
    public R selectBrandBySize(Integer page, Integer limit){
        return brandService.selectBrandBySize(page, limit);
    }

    /**
     * 上传
     */
    @RequestMapping("importBrands")
    public void importBrands(MultipartFile file) throws Exception {

    }

    /**
     * 全部下载
     */
    @RequestMapping("exportBrands")
    public void exportBrands(HttpServletResponse response) throws IOException {

    }

    @PostMapping("saveBrand")
    public R addBrand(PmsBrand brand){
        boolean save = brandService.save(brand);
        return R.ok();
    }
}
